import React, { useState } from 'react';

const Counter = () => {
    const [count, setCount] = useState(1);

    const handleIncrement = () => {
        setCount(prevCount => prevCount + 1);
    };

    const handleDecrement = () => {
        setCount(prevCount => prevCount - 1);
    };

    return (
        <div style={{ display: 'flex', alignItems: 'center' }}>
            <button onClick={handleDecrement} disabled={count === 0}>-</button>
            <input type="text" value={count} readOnly style={{ textAlign: 'center', margin: '0 10px' }} />
            <button onClick={handleIncrement}>+</button>
        </div>
    );
};

export default Counter;
